# Contributor: Bart Ribbers <bribbers@disroot.org>

# The group tag is just to easily find this APKBUILD by some scripts for automation
# group=kde-applications
maintainer="team/kde <bribbers@disroot.org>"
pkgname=kdepim-runtime
pkgver=24.08.2
pkgrel=0
pkgdesc="Extends the functionality of kdepim"
url="https://kontact.kde.org/"
# armhf blocked by extra-cmake-modules
# ppc64le, s390x, riscv64 and armv7 blocked by qt6-qtwebengine -> akonadi
# loongarch64 blocked by pimcommon
arch="all !armhf !ppc64le !s390x !riscv64 !armv7 !loongarch64"
license="LGPL-2.0-or-later"
makedepends="
	akonadi-calendar-dev
	akonadi-contacts-dev
	akonadi-dev
	akonadi-mime-dev
	akonadi-notes-dev
	extra-cmake-modules
	kcalendarcore-dev
	kcalutils-dev
	kcodecs-dev
	kconfig-dev
	kconfigwidgets-dev
	kcontacts-dev
	kdav-dev
	kdoctools-dev
	kholidays-dev
	kidentitymanagement-dev
	kimap-dev
	kio-dev
	kitemmodels-dev
	kmailtransport-dev
	kmbox-dev
	kmime-dev
	knotifications-dev
	knotifyconfig-dev
	ktextwidgets-dev
	kwindowsystem-dev
	libkgapi-dev
	libxslt-dev
	pimcommon-dev
	qca-qt6-dev
	qt6-qtbase-dev
	qt6-qtnetworkauth-dev
	qt6-qtspeech-dev
	samurai
	shared-mime-info
	"
checkdepends="
	dbus
	xvfb-run
	"
subpackages="$pkgname-dbg $pkgname-lang"
_repo_url="https://invent.kde.org/pim/kdepim-runtime.git"
source="https://download.kde.org/stable/release-service/$pkgver/src/kdepim-runtime-$pkgver.tar.xz"

build() {
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=RelWithDebInfo \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib
	cmake --build build
}

check() {
	local skipped_tests="(testresourcetask"
	local tests="
		testsessionpool
		testaddcollectiontask
		testadditemtask
		testchangecollectiontask
		testchangeitemtask
		testexpungecollectiontask
		testmoveitemstask
		testretrievecollectionmetadatatask
		testretrievecollectionstask
		testretrieveitemtask
		testretrieveitemstask
		akonadi-mysql-synctest
		akonadi-sqlite-synctest
		akonadi-mysql-pop3test
		akonadi-sqlite-pop3test
		"
	for test in $tests; do
		skipped_tests="$skipped_tests|$test"
	done
	skipped_tests="$skipped_tests)"
	dbus-run-session -- xvfb-run -a ctest --test-dir build --output-on-failure -E "$skipped_tests"
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
58f69a5f606be1fb74d0359788365387b618511eb67e73a06a2239f8ee49da9db375a9b24c7243e32f350058cb6d915b31fc646322bdc3e4e80cd5c8fcc2db7e  kdepim-runtime-24.08.2.tar.xz
"
